package com.wrx.constants.generatesql;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @date: 2018/12/10
 * @description: 常量
 */
public class Constants {

    public static final String TRACE_ID = "traceId";



    public static final String INSERT_SQL_PREFIX = "INSERT INTO ";

    public static final String INSERT_SQL_SUFFIX = ");";

    /**
     * 插入点位sql表公共字段
     */
    public static final String POINT_SQL_TABLE_FIELD = ".zhsc_scada_point (`id`, `point_code`, `point_name`, `point_unit`, `iot_device_id`, `iot_point_id`, `is_write`, `create_time`, `creator`, `update_time`, `updater`, `deleted`, `tenant_id`) VALUES (";
    /**
     * 插入点位sql表公共值
     */
    public static final String POINT_SQL_COMMON_VALUE = "'0', NULL, NULL, NULL, NULL, b'0', ";

    /**
     * 插入设备sql表公共字段
     */
    public static final String DEVICE_SQL_TABLE_FIELD = ".zhsc_scada_device (`id`, `factory_id`, `device_name`, `unit_code`, `location`, `msg_status`, `create_time`, `creator`, `update_time`, `updater`, `deleted`, `tenant_id`) VALUES (";

    /**
     * 插入设备sql表公共值
     */
    public static final String DEVICE_SQL_COMMON_VALUE = "'SSBF', '送水泵房', b'0', NULL, NULL, NULL, NULL, b'0', ";
    /**
     * 插入设备sql表公共值 version 2
     */
    public static final String DEVICE_SQL_COMMON_VALUE_V2 = "b'0', NULL, NULL, NULL, NULL, b'0', ";

    /**
     * 插入设备点位sql表公共字段
     */
    public static final String DEVICE_POINT_SQL_TABLE_FIELD = ".zhsc_scada_device_point (`id`, `device_id`, `point_code`, `point_show_name`, `status_type`, `status_value`, `create_time`, `creator`, `update_time`, `updater`, `deleted`, `tenant_id`) VALUES (";

    /**
     * 插入设备点位sql表公共值
     */
    public static final String DEVICE_POINT_SQL_COMMON_VALUE = "NULL, NULL, NULL, NULL, b'0', ";

    /**
     * 插入工艺单元sql表公共字段
     */
    public static final String UNIT_SQL_TABLE_FIELD = ".zhsc_scada_process_unit (`id`, `unit_code`, `unit_name`, `unit_logo`, `create_time`, `creator`, `update_time`, `updater`, `deleted`, `tenant_id`) VALUES (";

    /**
     * 插入工艺单元sql表公共值
     */
    public static final String UNIT_SQL_COMMON_VALUE = "'bengfang', NULL, NULL, NULL, NULL, b'0',";

    /**
     * 插入工艺单元点位sql表公共字段
     */
    public static final String UNIT_POINT_SQL_TABLE_FIELD = ".zhsc_scada_unit_point (`id`, `point_code`, `unit_code`, `create_time`, `creator`, `update_time`, `updater`, `deleted`, `tenant_id`) VALUES (";

    /**
     * 插入工艺单元点位sql表公共值
     */
    public static final String UNIT_POINT_SQL_COMMON_VALUE = "NULL, NULL, NULL, NULL, b'0', ";



    public static final Map<List<String>, String> POINT_UNIT_MAPPING = new LinkedHashMap<>();

    static {
        // 状态类型映射
        POINT_UNIT_MAPPING.put(Arrays.asList("远程"), " REMOTE NULL");
        POINT_UNIT_MAPPING.put(Arrays.asList("故障"), " FAILURE NULL");
        POINT_UNIT_MAPPING.put(Arrays.asList("开到位"), " SWITCH_ON NULL");
    }

    /*****************************************************监测点相关开始***********************************************/

    /**
     * 插入监测点sql表公共字段
     */
    public static final String INSERT_PIPE_FIELD = ".zhsc_scada_pipe (`id`, `pipe_name`, `pipe_coordinates`, `create_time`, `creator`, `update_time`, `updater`, `deleted`, `tenant_id`) VALUES (";
    /**
     * 插入监测点sql表公共值
     */
    public static final String INSERT_PIPE_VALUE = "NULL, NULL, NULL, NULL, b'0', ";

    /**
     * 插入监测点展示配置 sql表公共字段
     */
    public static final String INSERT_PIPE_SHOW_CONFIG_FIELD = ".`zhsc_scada_pipe_config` (`id`, `pipe_id`, `data_type`, `point_code`, `point_show_name`, `is_show`, `create_time`, `creator`, `update_time`, `updater`, `deleted`, `tenant_id`) VALUES (";
    /**
     * 插入监测点展示配置 sql表公共值
     */
    public static final String INSERT_PIPE_SHOW_CONFIG_VALUE = "'1', NULL, NULL, NULL, NULL, b'0', ";

    /*****************************************************监测点相关结束***********************************************/
}
